package com.wbb.service.impl;

import com.wbb.mapper.TbAdminMapper;
import com.wbb.model.TbAdmin;
import com.wbb.model.TbAdminExample;
import com.wbb.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private TbAdminMapper adminMapper;

    @Override
    public TbAdmin queryByUsername(String username) {
        TbAdminExample example = new TbAdminExample();
        example.createCriteria().andNameEqualTo(username);
        List<TbAdmin> tbAdmins = adminMapper.selectByExample(example);
        return (tbAdmins == null || tbAdmins.isEmpty()) ? null : tbAdmins.get(0);
    }
}
